/**
 * Created with Intellij IDEA.
 * Description:
 * User:Lenovo
 * Date:2024-12-06
 * Time:23:37
 */

public class LogIn {
    private static String userName1 = "admin";
    private static String password1 = "123456";
    public static void loginInfo(String userNames, String passwords)
            throws UserNameException,PasswordException{
        // 你的问题是这俩个if 没有执行是吗？ 是
        if (!userName1.equals(userNames)) {
            throw new UserNameException();
        }
        System.out.println("test");
        if (!password1.equals(passwords)) {
            throw new PasswordException("密码错误");
        }
//        System.out.println("登陆成功");
    }
    public static void main(String[] args) {
        try {
            loginInfo("admin", "1234"); // 那是你这儿传递得分1234，有什么问题吗
        } catch (UserNameException e) {
            System.out.println(e);
        } catch (PasswordException e) {
            System.out.println(e);
        }
    }
}
